package com.massyframework.beanskin.sample.servlet;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

import com.massyframework.beanskin.sample.ToDoItemRepository;
import com.massyframework.beanskin.service.DependencyService;

//@ComponentScan({
//"com.massyframework.beanskin.sample.servlet"})
//依赖服务-待办事项存储
@DependencyService(
		beanName = "toDoItemRepository",
		requireType = ToDoItemRepository.class)
@SpringBootConfiguration
public class SpringConfiguration extends SpringBootServletInitializer{

	public SpringConfiguration() {
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(SpringConfiguration.class);
	}
	
	@Bean
	public ToDoItemFormController toDoItemController() {
		return new ToDoItemFormController();
	}
}
